import Vue from 'vue';
import Router from 'vue-router';

const Layout = () => import(/* webpackChunkName:'Layout' */ '@/Layout');
const Home = () => import(/* webpackChunkName:'Home' */ '@/views/Home');
const Login = () => import(/* webpackChunkName:'Login' */ '@/views/Login');
<#list tableList as tables>
const ${tables.tableName} = () => import(/* webpackChunkName:'${tables.tableName}' */ '@/views/${tables.tableName}');
</#list>

Vue.use(Router);

// 动态路由表
export const asyncRoutes = [
	{
		path : '/home',
		component : Layout,
		meta : {
			title : '首页',
			icon : '',
			roles : []
		},
		children : [
			{
				path : '/',
				component : Home,
				meta : {
					title : '首页',
					icon : '',
					roles : []
				}
			}
		]
	},
	{
		path : '/system',
		component : Layout,
		meta : {
			title : '系统管理',
			icon : '',
			roles : []
		},
		children : [
			<#list tableList as tables>
			{
				path : '${tables.frontRouting}',
				component : ${tables.tableName},
				meta : {
					title : '<#if tables.comment??>${tables.comment}<#else></#if>',
					icon : '',
					roles : []
				}
			},
		</#list>
		]
	}
];

let router = new Router({
	base : process.env.BASE_URL,
	routes : [
		{
			path : '/login',
			component : Login,
			hidden : true, // 导航菜单忽略该项
			meta : {
				title : '登录'
			}
		}
	]
});

export default router;
